# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: kappa <kappacurve@gmail.com>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - strip -m32 and -m64 flags from makefile

pkgname=erlang-cl
pkgver=1.2.4
pkgrel=2
arch=('x86_64')
pkgdesc='OpenCL binding for Erlang'
url='https://github.com/tonyrog/cl'
license=('MIT')
depends=('erlang' 'opencl-icd-loader')
replaces=('cl')
makedepends=('git' 'opencl-headers' 'rebar')
source=("$pkgname::git+https://github.com/tonyrog/cl.git#tag=cl-$pkgver")
md5sums=('SKIP')

prepare() {
  cd "$pkgname"

  sed -i -e 's/ -m32//' -e 's/ -m64//' c_src/Makefile
}

build() {
  cd "$pkgname"

  rebar compile
}

package() {
  cd "$pkgname"

  install -d "$pkgdir/usr/lib/erlang/lib/cl-$pkgver"
  cp -r * "$pkgdir/usr/lib/erlang/lib/cl-$pkgver"
  install -Dm644 COPYRIGHT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

# vim: ts=2 sw=2 et:
